package fragmentson.backhandle;

import android.os.Bundle;
import android.support.v4.app.Fragment;

/**
 * author：wangqi on 2017/4/26 17:48
 * email：773630555@qq.com
 */
public abstract class BackHandledFragment extends Fragment {

	protected BackHandledInterface mBackHandledInterface;

	public abstract boolean onBackPressed();

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (!(getActivity() instanceof BackHandledInterface)) {
			throw new ClassCastException(
					"Hosting Activity must implement BackHandledInterface");
		} else {
			this.mBackHandledInterface = (BackHandledInterface) getActivity();
		}
	}

	@Override
	public void onStart() {
		super.onStart();
		mBackHandledInterface.setSelectedFragment(this);
	}
	 public void onResume() {
	        super.onResume();
	 }

	    public void onPause() {
	        super.onPause();
	 }

}
